<template>
	<view class="flex-col page">
		<view class="flex-col group_5">
			<view class="flex-col group_6">
				<view class="justify-between group_7" @click="selectaddress">
					<view class="infos">
						<div class="name">用餐地点</div>
						<input placeholder="点击选择用餐地址" :disabled="true" class="text_7" type="text" v-model="addr" />
					</view>
					<image src="http://images.wanjunshijie.com/product/cook/assets/ec9ee4e894993ad309b3773ab7dd21ad.png"
						class="image_6" />
				</view>
				<view class="justify-between group_7">
					<view class="infos">
						<div class="name">详细地址</div>
						<input placeholder="例如1栋1层101室" class="text_7" type="text" v-model="addrdetail" />
					</view>
				</view>
				<view class="justify-between group_7">
					<view class="infos">
						<div class="name">联系人</div>
						<input placeholder="请填写姓名" class="text_7" type="text" v-model="realname" />
					</view>

					<view class="flex-row group_12">
						<u-radio-group labelSize="12" size="14" v-model="sex" placement="row">
							<u-radio labelSize="12" :customStyle="{marginRight: '8px'}" activeColor="#FFDC05" :name="1"
								label="先生">
								先生
							</u-radio>
							<u-radio labelSize="12" activeColor="#FFDC05" :name="0" label="女士">女士</u-radio>
						</u-radio-group>
					</view>
				</view>
				<view class="justify-between group_7 noborder">
					<view class="infos">
						<div class="name">联系电话</div>
						<input class="text_7" type="text" placeholder="请填写手机号码" v-model="phone" />
					</view>
				</view>
			</view>
			<view @click="add" class="flex-col items-center button">
				<text>新增常用地址</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				addr: '',
				addrdetail: '',
				realname: '',
				phone: '',
				lng: '',
				lat: '',
				sex: 1
			};
		},
		methods: {
			selectaddress() {
				var that = this;
				uni.chooseLocation({
					success: function(res) {
						console.log(res);
						console.log('位置名称：' + res.name);
						console.log('详细地址：' + res.address);
						console.log('纬度：' + res.latitude);
						console.log('经度：' + res.longitude);
						that.address = res.address
					}
				});
			},
			add() {
				var that = this;
				if (!that.realname) {
					uni.showToast({
						title: '请输入真实姓名'
					})
					return
				}
				if (!that.bankname) {
					uni.showToast({
						title: '请输入开户行名称'
					})
					return
				}
				if (!that.bankaccount) {
					uni.showToast({
						title: '请输入银行卡账号'
					})
					return
				}
				dobind({
					realname: that.realname,
					bankname: that.bankname,
					bankaccount: that.bankaccount,
				}, {
					custom: {
						auth: true
					}
				}).then(res => {
					if (res.code == 1) {
						this.$refs.uToast.show({
							type: 'success',
							title: '提示',
							message: "添加成功",
							complete() {
								uni.navigateBack({})
							}
						})
					}
				}).catch(err => {

				})
			},

		}
	};
</script>

<style scoped lang="scss">
	.page {
		background-color: rgb(255, 255, 255);
		width: 100%;
		height: 100%;
		overflow-y: auto;

		.group_5 {
			padding: 20rpx 23rpx 85rpx 24rpx;
			flex: 1 1 auto;
			overflow-y: auto;
			.group_6 {
				.group_7 {
					height: 100rpx;
					border-bottom: solid 2rpx rgb(238, 238, 238);
					display: flex;
					justify-content: space-between;
					align-items: center;
					flex-wrap: nowrap;
					flex-direction: row;

					.infos {
						height: 100rpx;
						display: flex;
						justify-content: flex-start;
						align-items: center;
						flex-wrap: nowrap;
						flex-direction: row;
					}

					input {
						height: 100rpx;
						width: 300rpx;
					}

					.image_6 {
						width: 14rpx;
						height: 24rpx;
					}

					.text_6 {
						color: rgb(59, 59, 59);
						font-size: 26rpx;
						line-height: 25rpx;
						white-space: nowrap;
					}

					.text_7 {
						margin-left: 27rpx;
						color: rgb(172, 170, 170);
						font-size: 24rpx;
						line-height: 22rpx;
						white-space: nowrap;
					}
				}

				.group_9 {
					padding: 36rpx 11rpx;
					border-bottom: solid 2rpx rgb(238, 238, 238);

					.text_8 {
						color: rgb(59, 59, 59);
						font-size: 26rpx;
						line-height: 24rpx;
						white-space: nowrap;
					}

					.text_9 {
						margin-left: 27rpx;
						color: rgb(172, 170, 170);
						font-size: 24rpx;
						line-height: 23rpx;
						white-space: nowrap;
					}
				}

				.group_10 {
					padding: 35rpx 0 37rpx 11rpx;
					border-bottom: solid 2rpx rgb(238, 238, 238);

					.group_12 {
						color: rgb(172, 170, 170);
						font-size: 24rpx;
						line-height: 22rpx;
						white-space: nowrap;

						.group_14 {
							margin-left: 27rpx;

							.text_13 {
								margin-left: 8rpx;
							}
						}

						.text_12 {
							margin-left: 10rpx;
						}

						.image_7 {
							margin-top: 3rpx;
							width: 19rpx;
							height: 19rpx;
						}
					}

					.text_10 {
						color: rgb(59, 59, 59);
						font-size: 26rpx;
						line-height: 25rpx;
						white-space: nowrap;
					}

					.text_11 {
						margin-left: 53rpx;
						color: rgb(172, 170, 170);
						font-size: 24rpx;
						line-height: 23rpx;
						white-space: nowrap;
					}
				}

				.group_15 {
					padding: 37rpx 11rpx 35rpx;

					.text_14 {
						color: rgb(59, 59, 59);
						font-size: 26rpx;
						line-height: 25rpx;
						white-space: nowrap;
					}

					.text_15 {
						margin-left: 27rpx;
						color: rgb(172, 170, 170);
						font-size: 24rpx;
						line-height: 23rpx;
						white-space: nowrap;
					}
				}
			}

			.button {
				margin: 513rpx 26rpx 0 25rpx;
				padding: 18rpx 0;
				color: rgb(255, 255, 255);
				font-size: 30rpx;
				line-height: 29rpx;
				white-space: nowrap;
				background-color: rgb(247, 176, 18);
				border-radius: 15rpx;
			}
		}

		.tab-bar {
			padding: 7rpx 55rpx 29rpx 62rpx;

			.group_16 {
				color: rgb(0, 0, 0);
				font-size: 22rpx;
				line-height: 22rpx;
				white-space: nowrap;
				width: 59rpx;
				height: 81rpx;

				.text_17 {
					margin-top: 5rpx;
				}
			}

			.group_17 {
				width: 59rpx;
				height: 81rpx;

				.text_18 {
					margin-top: 6rpx;
				}

				.text_19 {
					margin-top: 5rpx;
				}
			}

			.view {
				color: rgb(0, 0, 0);
				font-size: 22rpx;
				line-height: 21rpx;
				white-space: nowrap;
			}

			.view_1 {
				color: rgb(0, 0, 0);
				font-size: 22rpx;
				line-height: 22rpx;
				white-space: nowrap;
			}

			.group_18 {
				color: rgb(0, 0, 0);
				font-size: 22rpx;
				line-height: 20rpx;
				white-space: nowrap;
				width: 60rpx;
				height: 80rpx;

				.text_20 {
					margin-top: 6rpx;
				}
			}

			.image_10 {
				width: 54rpx;
				height: 54rpx;
			}
		}
	}

	.text_9 {
		width: 500rpx;
	}

	.name {
		font-size: 26rpx;
		font-family: PingFang;
		font-weight: 500;
		color: #3B3B3B;
		display: flex;
		justify-content: flex-start;
		width: 150rpx;
		align-items: center;
		flex-wrap: nowrap;
		flex-direction: row;
	}

	.noborder {
		border-bottom: 0;
	}
</style>
